package com.coding.service.impl;

import com.coding.base.pojo.BaseModel;
import com.coding.dao.PlaceDao;
import com.coding.pojo.Place;
import com.coding.service.PlaceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @auther wangchenghao
 * @date 2020/9/3
 **/
@Service
public class PlaceImpl implements PlaceService {
    @Autowired
    PlaceDao placeDao;
    @Override
    public void selectById(int place_id, BaseModel baseModel) throws Exception {
        Place place=placeDao.selectSingle(place_id);
        if (place!=null){
            baseModel.setSucceed("成功获得特色景点",place);
        }else{
            baseModel.setFailure("获得特色景点失败");
        }
    }

    @Override
    public void selectByMainPlaceId(int main_place_id, BaseModel baseModel) throws Exception {
        List<Place> placeList=placeDao.selectByMainPlaceId(main_place_id);
        if (placeList!=null){
            baseModel.setSucceed("成功获得特色景点",(placeList));
        }else{
            baseModel.setFailure("获得特色景点失败");
        }
    }
}
